//
//  DownloadHistoryViewController.m
//  IntegralDog
//
//  Created by HanenDev on 16/1/25.
//  Copyright © 2016年 hanen. All rights reserved.
//

#import "DownloadHistoryViewController.h"
#import "DownloadHistoryCell.h"

#define SCREENWIDTH self.view.bounds.size.width
#define SCREENHEIGHT self.view.bounds.size.height

@interface DownloadHistoryViewController ()<UITableViewDataSource,UITableViewDelegate>

@end

@implementation DownloadHistoryViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
//    self.title = @"下载记录";
//    UIButton *backBtn=[[UIButton alloc]initWithFrame:CGRectMake(0, 0, 15, 25)];
//    [backBtn setImage:[UIImage imageNamed:@"Btn_Nourmal_Jiantou"] forState:UIControlStateNormal];
//    [backBtn setImage:[UIImage imageNamed:@"Btn_Push_Jiantou"] forState:UIControlStateSelected];
//    [backBtn addTarget:self action:@selector(goToBack) forControlEvents:UIControlEventTouchUpInside];
//    self.navigationItem.leftBarButtonItem=[[UIBarButtonItem alloc]initWithCustomView:backBtn];
    
    [self createTableView];
    
}
- (void)createTableView{
    UITableView *tableView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain];
    tableView.delegate = self;
    tableView.dataSource = self;
    tableView.rowHeight = 80.0f;
    [self.view addSubview:tableView];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 5;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 2;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 30.0f;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    UIView *view=[[UIView alloc]init];
    view.backgroundColor = [UIColor colorWithWhite:0.8 alpha:1.0];
    UIImageView *picView = [[UIImageView alloc]initWithFrame:CGRectMake(15, 5, 20, 20)];
    picView.image = [UIImage imageNamed:@"Btn_Normal_Shijianjilu"];
    [view addSubview:picView];
    
    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(30+10, 5, SCREENWIDTH, 20)];
    label.text = @"下载于2016.02.25";
    label.textColor = [UIColor grayColor];
    [view addSubview:label];
    return view;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *identifier = @"cell";
    DownloadHistoryCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    if (cell == nil) {
        cell = [[DownloadHistoryCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    cell.imagView.image = [UIImage imageNamed:@"Btn_Normal_Bantang"];
    
    cell.nameLabel.text = @"半塘-帮你买到好东西";
    
    cell.editionLabel.text = @"版本2.0.0  2222MB";
    
    cell.updataLabel.text = @"新功能已更新";
    
    cell.picView.image = [UIImage imageNamed:@"Btn_Normal_Jifenganniu"];
    
    cell.countLabel.text = @"2222";
    return cell;
}

- (void)goToBack{
    //[self.navigationController popViewControllerAnimated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
